using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.Model;
using emp.IDAL;
using emp.ProcessFlow;
using emp.BLL;
using emp.Model.SysManage;

public partial class ItemManage_Item_Modify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string pID = "0";
            if (Request.Params["ID"] != null && Request.Params["ID"].Equals("") == false)
            {
                pID = Request.Params["ID"];
            }
            Item tv = new Item();
            IList list = tv.getCurrNode("0", int.Parse(pID));
            if (list.Count > 0)
            {
                TreeInfo tf = (TreeInfo)list[0];
                Item_ID.Text = pID;
                Item_Name.Text = tf.Node_Name;
                Item_Desc.Text = tf.Node_Desc;
                Parent_Item_ID.Text = tf.Parent_Node_ID.ToString();
            }
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string ItemName = Item_Name.Text.Trim();
            string ItemDesc = Item_Desc.Text.Trim();
            int iParent_Item_ID = int.Parse(Parent_Item_ID.Text.Trim());
            int iItem_ID = int.Parse(Item_ID.Text.Trim());
            ItemInfo iInfo = new ItemInfo(iItem_ID,iParent_Item_ID, ItemName, ItemDesc);
            ItemController iCon = new ItemController();
            iCon.UpdateItem(iInfo);
        }
    }
}
